﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MainNav.ascx.cs" Inherits="UserControls_MainNav" %>
<%@ Import Namespace="BLL" %>
<script runat="server">
    MenuBLL dataMenu = new MenuBLL();
    </script>
                    <%
                        int idPosition = 1;
                        var listMenu = dataMenu.GetByParent(-1);
                         %>
                     <ul id="nav">
                     <%
                         for (int i = 0; i < listMenu.Count; i++)
                         {
                             string name = listMenu[i].Name;
                             string link = listMenu[i].Link;
                             switch (listMenu[i].Mode)
                             {
                                 case 1:
                                     link = "/Home.aspx";
                                     //link = Myfunction.GenarateUrlHome("trang-chu");
                                     break;
                                 case 2:
                                     link = "/ArticlesDetails.aspx?Id=" + listMenu[i].Link.ToString();
                                     //link = Myfunction.GenarateUrlHome(listMenu[i].Name);
                                     break;
                                 case 3:
                                     link = "/ArticlesCategory.aspx?Id=" + listMenu[i].Link;
                                     //link = Myfunction.GenarateUrlNewsCate(link, "1", "danh-muc", name);
                                     break;
                                 case 5:
                                     link = "/lien-he.aspx";
                                     break;
                                 case 7:
                                     link = "/ArticlesDetails.aspx?Id=" + listMenu[i].Link;
                                     break;
                                 default:
                                     break;
                             }
                             if (i == listMenu.Count - 1)
                             { 
                                %>
                                <li class="last"><a href="<%=link %>"><%=name%></a></li>
                                    <%
                             }
                             else
                             { 
                                %>
                                <li><a href="<%=link %>"><%=name%></a></li>
                                    <%
                             }
                         }
                              %>
					</ul>